]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Revert "windowMenu: Do actions requiring grab once ungrabbed"
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 17 Jan 2023 17:40:10 +0000 (18:40 +0100)
committerMarge Bot <marge-bot@gnome.org>
Mon, 30 Jan 2023 12:19:22 +0000 (12:19 +0000)
This reverts commit 2b3ab3ececd2b70023547552b1acf84cbc4fecb1.

Since the window menu no longer uses a MetaDisplay grab, but directly
a ClutterGrab, this is ineffective. But also, grabs are stackable, so
it's fine to push the window operation grab first and then dismiss the
window menu grab, even when MetaDisplay grabs get ported to using
ClutterGrab underneath. We now can just grab right away, so do that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2526>

js/ui/windowMenu.js

index 081645f04238c9682114541a8af7fb94409a4b3a..c5a63280303a59adc1d3201ce9b99929ca0d71cb 100644 (file)
@@ -1,7 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*
 /* exported WindowMenuManager */
 
-const { GLib, Meta, St } = imports.gi;
+const {Meta, St} = imports.gi;
 
 const BoxPointer = imports.ui.boxpointer;
 const Main = imports.ui.main;
@@ -57,13 +57,13 @@ var WindowMenu = class extends PopupMenu.PopupMenu {
             item.setSensitive(false);
 
         item = this.addAction(_("Move"), event => {
-            this._grabAction(window, Meta.GrabOp.KEYBOARD_MOVING, event.get_time());
+            window.begin_grab_op(Meta.GrabOp.KEYBOARD_MOVING, true, event.get_time());
         });
         if (!window.allows_move())
             item.setSensitive(false);
 
         item = this.addAction(_("Resize"), event => {
-            this._grabAction(window, Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN, event.get_time());
+            window.begin_grab_op(Meta.GrabOp.KEYBOARD_RESIZING_UNKNOWN, true, event.get_time());
         });
         if (!window.allows_resize())
             item.setSensitive(false);
@@ -184,26 +184,6 @@ var WindowMenu = class extends PopupMenu.PopupMenu {
         if (!window.can_close())
             item.setSensitive(false);
     }
-
-    _grabAction(window, grabOp, time) {
-        if (global.display.get_grab_op() == Meta.GrabOp.NONE) {
-            window.begin_grab_op(grabOp, true, time);
-            return;
-        }
-
-        let waitId = 0;
-        let id = global.display.connect('grab-op-end', display => {
-            display.disconnect(id);
-            GLib.source_remove(waitId);
-
-            window.begin_grab_op(grabOp, true, time);
-        });
-
-        waitId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 100, () => {
-            global.display.disconnect(id);
-            return GLib.SOURCE_REMOVE;
-        });
-    }
 };
 
 var WindowMenuManager = class {